package com.redsoft.epip.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.vdurmont.emoji.EmojiParser;

/**
 * The persistent class for the USER_INFO database table.
 */
@Entity
@Table(name = "USER_INFO")
@NamedQuery(name = "Member.findAll", query = "SELECT u FROM Member u")
public class Member implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	private String id;

	@Column(name = "NICKNAME")
	private String nickname; // 昵称

	@Column(name = "HEADIMGURL")
	private String headImgUrl; // 头像

	@Column(name = "OPEN_ID")
	private String openId;

	@Column(name = "SEX_ID")
	private Integer sexId;

	@Column(name = "SEX")
	private String sex; // 性别

	@Column(name = "PHONE_NO")
	private String phoneNo; // 手机号码

	@Column(name = "COUNTRY")
	private String country;

	@Column(name = "PROVINCE")
	private String province;

	@Column(name = "CITY")
	private String city;

	@Column(name = "SUBSCRIBE_FROM")
	private Integer subscribeFrom;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "subscribe_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date subscribeTime;

	@Column(name = "SCORE")
	private Integer score;

	@Column(name = "UNION_ID")
	private String unionId;

	@Column(name = "GROUP_ID")
	private String groupId;

	@Column(name = "REMARK")
	private String remark; // 

	@Column(name = "IS_DELETED")
	private Integer isDeleted;
	
	@Column(name = "REFEREE")
	private String referee;//推荐关注人id
	
	@Column(name = "IS_DRAW")
	private Integer isDraw; //用户是否已领取新人优惠券
	
	@Transient
	private String refereeName;//推荐人昵称
	
	@Transient
	private Integer position;//排行榜名次
	
	@Transient
	private Integer quantity;//推荐关注用户数量

	public Member() {
		super();
	}

	public Member(String id, String nickname, String headImgUrl, String openId, Integer sexId, String sex,
			String phoneNo, String country, String province, String city, Integer subscribeFrom, Date subscribeTime,
			Integer score, String unionId, String groupId, String remark, Integer isDeleted) {
		this.id = id;
		this.nickname = nickname;
		this.headImgUrl = headImgUrl;
		this.openId = openId;
		this.sexId = sexId;
		this.sex = sex;
		this.phoneNo = phoneNo;
		this.country = country;
		this.province = province;
		this.city = city;
		this.subscribeFrom = subscribeFrom;
		this.subscribeTime = subscribeTime;
		this.score = score;
		this.unionId = unionId;
		this.groupId = groupId;
		this.remark = remark;
		this.isDeleted = isDeleted;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = EmojiParser.parseToUnicode(nickname);
	}

	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl = headImgUrl;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public Integer getSexId() {
		return sexId;
	}

	public void setSexId(Integer sexId) {
		this.sexId = sexId;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getPhoneNo() {
		return phoneNo;
	}

	public void setPhoneNo(String phoneNo) {
		this.phoneNo = phoneNo;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Integer getSubscribeFrom() {
		return subscribeFrom;
	}

	public void setSubscribeFrom(Integer subscribeFrom) {
		this.subscribeFrom = subscribeFrom;
	}

	public Date getSubscribeTime() {
		return subscribeTime;
	}

	public void setSubscribeTime(Date subscribeTime) {
		this.subscribeTime = subscribeTime;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public String getUnionId() {
		return unionId;
	}

	public void setUnionId(String unionId) {
		this.unionId = unionId;
	}

	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getIsDeleted() {
		return isDeleted;
	}

	public void setIsDeleted(Integer isDeleted) {
		this.isDeleted = isDeleted;
	}

	public String getReferee() {
		return referee;
	}

	public void setReferee(String referee) {
		this.referee = referee;
	}

	public String getRefereeName() {
		return refereeName;
	}

	public void setRefereeName(String refereeName) {
		this.refereeName = refereeName == null ? refereeName : EmojiParser.parseToUnicode(refereeName);
	}

	public Integer getIsDraw() {
		return isDraw;
	}

	public void setIsDraw(Integer isDraw) {
		this.isDraw = isDraw;
	}

	public Integer getPosition() {
		return position;
	}

	public void setPosition(Integer position) {
		this.position = position;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

}